package com.atdel.demo06;


import java.util.Arrays;
import java.util.List;

/**
 * @BelongsProject: java_study
 * @BelongsPackage: com.atdel.demo06
 * @Author: Del
 * @CreateTime: 2025-03-04  13:14
 * @Description: TODO
 * @Version: 1.0
 */
public class MainTest01 {
    public static void main(String[] args) {
        // 创建不同类型的门
        Door iron = new IronDoor();
        Door wood = new WoodDoor();
        Door security = new SecurityDoor();

        // 用户拥有所有门
         User user = new User( Arrays.asList(iron, wood, security));
        user.operateDoors(true); // 打开门

        // 小偷偷盗防盗门（30% 成功率）
        Thief thief = new Thief();
        boolean stolen = thief.steal(security);
        System.out.println("防盗门盗窃结果：" + (stolen ? "✅ 成功！" : "❌ 失败！"));

        // 小偷偷盗汽车（假设汽车存在）
        Car car = new Car();
        stolen = thief.steal(car);
        System.out.println("汽车盗窃结果：" + (stolen ? "✅ 成功！" : "❌ 失败！"));

        // 关闭所有门
         user.operateDoors(false);
    }
}
